package com.yDev.stock_runner;
import java.util.ArrayList;
import java.util.Random;

import android.graphics.Canvas;


public class ParticleEmitter {
	
ArrayList<Particle> particles;
Random rand=new Random(1000);



public ParticleEmitter(int size){
	particles=new ArrayList<Particle>();


/*	for (int i=0; i<size; i++){
		particles[i]= new Particle();
	}*/
}

public void emitParticle(){
	
	
	Particle p =new Particle(new ydPoint(300, 500), new ydPoint(0.2f,0.2f/*rand.nextInt(20)-10, rand.nextInt(20)-10*/), 100, rand.nextInt(10));
	particles.add(p);
}

public void update(){
	for(int i=0; i<particles.size();i++){
		if(particles.get(i).life<=0){
			particles.remove(i);
		}
		else{
			particles.get(i).update();
		}
	}
	
	return;
}

public void draw(Canvas canvas){
	for(int i=0; i<particles.size();i++){
		particles.get(i).draw(canvas);
	}
}



}
